Install packages

if(!require("htmltools")) install.packages("htmltools") 
if(!require("remotes")) install.packages("remotes") 
if(!require("MultiEWCE")) remotes::install_github("neurogenomics/MutltiEWCE", dependencies = TRUE)

Prioritise targets

Gather data

results <- MultiEWCE::load_example_results()
ctd <- MultiEWCE::load_example_ctd()

Run filtering/sorting procedure

Top 3 targets per cell type-phenotype association

top_targets <- MultiEWCE::prioritise_targets(results = results,
                                             ctd = ctd,
                                             top_n = 3)
## Prioritising gene targets.
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype_to_genes.txt
## Prioritised targets: 
##  - 424,039 results 
##  - 5,507 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Filtering @ q-value <= 0.05
## Prioritised targets: 
##  - 7,545 results 
##  - 2,527 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Filtering @ fold-change >= 1
## Prioritised targets: 
##  - 7,545 results 
##  - 2,527 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Annotating phenos with Tiers.
## Prioritised targets: 
##  - 106 results 
##  - 11 phenotypes 
##  - 36 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype.hpoa
## Annotating phenos with Onset.
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype.hpoa
## Prioritised targets: 
##  - 523 results 
##  - 11 phenotypes 
##  - 36 cell types 
##  - 42 associated diseases 
##  - 0 genes
## 20 / 36 of cell types kept.
## Prioritised targets: 
##  - 342 results 
##  - 11 phenotypes 
##  - 20 cell types 
##  - 42 associated diseases 
##  - 0 genes
## Filtering by gene size.
## Converting phenos to GRanges.
## Loading required namespace: ensembldb
## Gathering gene metadata
## Loading required namespace: EnsDb.Hsapiens.v75
## 120 / 2,213 genes kept.
## Filtering by specificity_quantile.
## Filtering by mean_exp_quantile.
## Prioritised targets: 
##  - 224 results 
##  - 9 phenotypes 
##  - 0 cell types 
##  - 0 associated diseases 
##  - 70 genes
## Prioritised targets: 
##  - 335 results 
##  - 9 phenotypes 
##  - 15 cell types 
##  - 39 associated diseases 
##  - 24 genes
## Sorting rows.
## Finding top 3 gene targets per: HPO_ID, CellType
## Prioritised targets: 
##  - 80 results 
##  - 9 phenotypes 
##  - 15 cell types 
##  - 17 associated diseases 
##  - 21 genes

All cell type-phenotype associations that met criterion

all_targets <- MultiEWCE::prioritise_targets(results = results,
                                             ctd = ctd, 
                                             top_n = NULL)
## Prioritising gene targets.
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype_to_genes.txt
## Prioritised targets: 
##  - 424,039 results 
##  - 5,507 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Filtering @ q-value <= 0.05
## Prioritised targets: 
##  - 7,545 results 
##  - 2,527 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Filtering @ fold-change >= 1
## Prioritised targets: 
##  - 7,545 results 
##  - 2,527 phenotypes 
##  - 77 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Annotating phenos with Tiers.
## Prioritised targets: 
##  - 106 results 
##  - 11 phenotypes 
##  - 36 cell types 
##  - 0 associated diseases 
##  - 0 genes
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype.hpoa
## Annotating phenos with Onset.
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype.hpoa
## Prioritised targets: 
##  - 523 results 
##  - 11 phenotypes 
##  - 36 cell types 
##  - 42 associated diseases 
##  - 0 genes
## 20 / 36 of cell types kept.
## Prioritised targets: 
##  - 342 results 
##  - 11 phenotypes 
##  - 20 cell types 
##  - 42 associated diseases 
##  - 0 genes
## Filtering by gene size.
## Converting phenos to GRanges.
## Gathering gene metadata
## 120 / 2,213 genes kept.
## Filtering by specificity_quantile.
## Filtering by mean_exp_quantile.
## Prioritised targets: 
##  - 224 results 
##  - 9 phenotypes 
##  - 0 cell types 
##  - 0 associated diseases 
##  - 70 genes
## Prioritised targets: 
##  - 335 results 
##  - 9 phenotypes 
##  - 15 cell types 
##  - 39 associated diseases 
##  - 24 genes
## Sorting rows.
## Prioritised targets: 
##  - 335 results 
##  - 9 phenotypes 
##  - 15 cell types 
##  - 39 associated diseases 
##  - 24 genes

Aggregate results

df_agg <- MultiEWCE::agg_results(phenos = all_targets,
                                 count_var = "CellType", 
                                 group_var = "Phenotype")
## Aggregating results by group_var='Phenotype'
## Adding HPO IDs.
## Importing existing file: /Users/schilder/Library/Caches/org.R-project.R/R/HPOExplorer/data/phenotype_to_genes.txt
MultiEWCE::create_dt(df_agg)
## Loading required namespace: DT

Aggregate results from Intellectual Disability phenotypes

Subset phenotypes to those included in intellectual disability, and are related to cognition.

df_intel <- all_targets[disease_characteristic=="Intellectual disability" &
                        (!Phenotype %in% c("Choreoathetosis","Coma")),]

Top genes

top_genes <- sort(table(df_intel$Gene),
                  decreasing = TRUE)
print(top_genes)
## 
##       SOX3       SIX6     POU3F4       GSX2       SOX2      FOXG1       PIGY 
##         42         41         29         28         28         27         23 
##     TUBB2A      PROP1      GPR88       RTL1 SNORD116-1   SNORD118      FOXH1 
##         19         18         14         14         14         14          1 
##      HOXA2      PRRT2    SLC18A3 
##          1          1          1

Top cell types

top_celltypes <- sort(table(unique(df_intel[,c("Phenotype","HPO_ID","CellType")])$CellType),
         decreasing = TRUE)
print(top_celltypes)
## 
## Excitatory neurons     Ganglion cells    Granule neurons Inhibitory neurons 
##                  4                  4                  3                  3 
##   Purkinje neurons     Amacrine cells         Astrocytes           ENS glia 
##                  3                  2                  2                  2 
##   Horizontal cells   Oligodendrocytes      Bipolar cells   Visceral neurons 
##                  2                  2                  1                  1

Plot targets

Network

Generate a network from the top phenotype-celltype-gene associations.

vn <- MultiEWCE::prioritise_targets_network(top_targets = top_targets, 
                                            save_path = "targets_network.html",
                                            show_plot = FALSE)
## Loading required namespace: igraph
## Loading required namespace: visNetwork
## Creating network.
## Creating plot.
## Saving plot ==> targets_network.html
# visNetwork::renderVisNetwork(vn$plot)
htmltools::includeHTML("https://github.com/neurogenomics/RareDiseasePrioritisation/raw/master/reports/targets_network.html")
visNetwork

Session info

utils::sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] MultiEWCE_0.1.3 remotes_2.4.2   htmltools_0.5.4
## 
## loaded via a namespace (and not attached):
##   [1] utf8_1.2.2                    R.utils_2.12.2               
##   [3] tidyselect_1.2.0              RSQLite_2.2.20               
##   [5] AnnotationDbi_1.60.0          htmlwidgets_1.6.1            
##   [7] grid_4.2.1                    BiocParallel_1.32.5          
##   [9] munsell_0.5.0                 codetools_0.2-18             
##  [11] DT_0.27                       colorspace_2.1-0             
##  [13] Biobase_2.58.0                filelock_1.0.2               
##  [15] knitr_1.42                    rstudioapi_0.14              
##  [17] orthogene_1.4.1               stats4_4.2.1                 
##  [19] SingleCellExperiment_1.20.0   ggsignif_0.6.4               
##  [21] MatrixGenerics_1.10.0         GenomeInfoDbData_1.2.9       
##  [23] bit64_4.0.5                   coda_0.19-4                  
##  [25] vctrs_0.5.2                   treeio_1.22.0                
##  [27] generics_0.1.3                xfun_0.36                    
##  [29] BiocFileCache_2.6.0           R6_2.5.1                     
##  [31] GenomeInfoDb_1.34.6           pals_1.7                     
##  [33] AnnotationFilter_1.22.0       bitops_1.0-7                 
##  [35] cachem_1.0.6                  gridGraphics_0.5-1           
##  [37] DelayedArray_0.24.0           assertthat_0.2.1             
##  [39] promises_1.2.0.1              BiocIO_1.8.0                 
##  [41] scales_1.2.1                  gtable_0.3.1                 
##  [43] ontologyPlot_1.6              ensembldb_2.22.0             
##  [45] rlang_1.0.6                   rtracklayer_1.58.0           
##  [47] rstatix_0.7.1                 lazyeval_0.2.2               
##  [49] dichromat_2.0-0.1             broom_1.0.3                  
##  [51] BiocManager_1.30.19           yaml_2.3.7                   
##  [53] reshape2_1.4.4                HPOExplorer_0.99.2           
##  [55] abind_1.4-5                   GenomicFeatures_1.50.4       
##  [57] ggnetwork_0.5.10              crosstalk_1.2.0              
##  [59] backports_1.4.1               httpuv_1.6.8                 
##  [61] tools_4.2.1                   ggplotify_0.1.0              
##  [63] statnet.common_4.8.0          ggplot2_3.4.0                
##  [65] ellipsis_0.3.2                jquerylib_0.1.4              
##  [67] paintmap_1.0                  BiocGenerics_0.44.0          
##  [69] Rcpp_1.0.10                   plyr_1.8.8                   
##  [71] visNetwork_2.1.2              progress_1.2.2               
##  [73] zlibbioc_1.44.0               purrr_1.0.1                  
##  [75] RCurl_1.98-1.9                prettyunits_1.1.1            
##  [77] ggpubr_0.5.0                  S4Vectors_0.36.1             
##  [79] SummarizedExperiment_1.28.0   grr_0.9.5                    
##  [81] magrittr_2.0.3                data.table_1.14.6            
##  [83] ProtGenerics_1.30.0           matrixStats_0.63.0           
##  [85] hms_1.1.2                     patchwork_1.1.2              
##  [87] mime_0.12                     evaluate_0.20                
##  [89] xtable_1.8-4                  XML_3.99-0.13                
##  [91] EWCE_1.6.0                    IRanges_2.32.0               
##  [93] compiler_4.2.1                biomaRt_2.54.0               
##  [95] tibble_3.1.8                  maps_3.4.1                   
##  [97] crayon_1.5.2                  R.oo_1.25.0                  
##  [99] ggfun_0.0.9                   later_1.3.0                  
## [101] tidyr_1.3.0                   aplot_0.1.9                  
## [103] DBI_1.1.3                     ExperimentHub_2.6.0          
## [105] gprofiler2_0.2.1              dbplyr_2.3.0                 
## [107] rappdirs_0.3.3                babelgene_22.9               
## [109] EnsDb.Hsapiens.v75_2.99.0     Matrix_1.5-3                 
## [111] car_3.1-1                     piggyback_0.1.4              
## [113] cli_3.6.0                     R.methodsS3_1.8.2            
## [115] parallel_4.2.1                igraph_1.3.5                 
## [117] GenomicRanges_1.50.2          pkgconfig_2.0.3              
## [119] GenomicAlignments_1.34.0      plotly_4.10.1                
## [121] xml2_1.3.3                    ggtree_3.6.2                 
## [123] bslib_0.4.2                   XVector_0.38.0               
## [125] yulab.utils_0.0.6             stringr_1.5.0                
## [127] digest_0.6.31                 graph_1.76.0                 
## [129] Biostrings_2.66.0             rmarkdown_2.20               
## [131] HGNChelper_0.8.1              tidytree_0.4.2               
## [133] restfulr_0.0.15               curl_5.0.0                   
## [135] shiny_1.7.4                   Rsamtools_2.14.0             
## [137] rjson_0.2.21                  lifecycle_1.0.3              
## [139] nlme_3.1-161                  jsonlite_1.8.4               
## [141] carData_3.0-5                 network_1.18.1               
## [143] mapproj_1.2.11                viridisLite_0.4.1            
## [145] limma_3.54.0                  fansi_1.0.4                  
## [147] pillar_1.8.1                  ontologyIndex_2.10           
## [149] lattice_0.20-45               homologene_1.4.68.19.3.27    
## [151] KEGGREST_1.38.0               fastmap_1.1.0                
## [153] httr_1.4.4                    interactiveDisplayBase_1.36.0
## [155] glue_1.6.2                    RNOmni_1.0.1                 
## [157] png_0.1-8                     ewceData_1.6.0               
## [159] BiocVersion_3.16.0            bit_4.0.5                    
## [161] Rgraphviz_2.42.0              stringi_1.7.12               
## [163] sass_0.4.5                    blob_1.2.3                   
## [165] AnnotationHub_3.6.0           memoise_2.0.1                
## [167] dplyr_1.0.10                  ape_5.6-2